package com.peng.wx_official_account.entity.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

@Getter
@AllArgsConstructor
@SuppressWarnings("SpellCheckingInspection")
public enum AreaEnum {

    ZHENG_ZHOU("郑州", "101180106"),
    HANG_ZHOU("杭州", "101210101"),
    RU_YANG("汝阳", "101180910"),
    SHANG_QIU("商丘", "101181001");

    private final String name;
    private final String location;

    /**
     * Get location by name string.
     * 根据城市名称获得城市代码
     *
     * @param name the name
     * @return the string
     */
    public String getLocationByName(String name) {
        for (AreaEnum area : values()) {
            if (area.name.equals(name)) {
                return area.location;
            }
        }
        return null;
    }
}
